/**
 * 
 */
package kr.co.insoft.auth.mapper.organization;

import java.util.List;

import kr.co.insoft.auth.model.organization.OrganizationUserEntityModel;
import kr.co.insoft.auth.service.initalize.InitializeTableService;
import kr.co.insoft.framework.mybatis.Mapper;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;

/**
 * @author IN-SOFT Inc. GoodwillDD(sylee@in-soft.co.kr)
 * 
 */
@Mapper
public interface OrganizationUserMapper {
	/**
	 * 사용자 - 조직 매핑
	 * 
	 * @param organizationUserEntityModel
	 * @throws Exception
	 */
	@Insert("INSERT INTO `"+InitializeTableService.USERS_ORG+"`(`userid`, `orgid`) VALUES(#{userid}, #{orgid})")
	public void createOrganizationUser(
			OrganizationUserEntityModel organizationUserEntityModel)
			throws Exception;

	/**
	 * 사용자에 해당하는 Organization
	 * 
	 * @return
	 * @throws Exception
	 */
	@Select("SELECT * FROM `"+InitializeTableService.USERS_ORG+"` WHERE `userid` = #{userid}")
	public List<OrganizationUserEntityModel> getUserOrgs(Long userid)
			throws Exception;

}
